﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Collections.ObjectModel;
using System.Windows;
using System.ComponentModel;
using System.Windows.Data;
using System.Windows.Input;

namespace D24W3R
{
    public class PointSettings: DependencyObject
    {
        public double Radius
        {
            get { return (double)GetValue(RadiusProperty); }
            set { SetValue(RadiusProperty, value); }
        }

        // Using a DependencyProperty as the backing store for Radius.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty RadiusProperty =
            DependencyProperty.Register("Radius", typeof(double), typeof(PointSettings), new UIPropertyMetadata(3.0));
    }

    public class PanZoomSettings : DependencyObject
    {
        public double ScaleX
        {
            get { return (double)GetValue(ScaleXProperty); }
            set { SetValue(ScaleXProperty, Math.Max(value, Math.Pow(0.8, 10))); }
        }

        // Using a DependencyProperty as the backing store for ScaleX.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty ScaleXProperty =
            DependencyProperty.Register("ScaleX", typeof(double), typeof(PanZoomSettings), new UIPropertyMetadata(1.0));


        public double ScaleY
        {
            get { return (double)GetValue(ScaleYProperty); }
            set { SetValue(ScaleYProperty, Math.Max(value, Math.Pow(0.8, 10))); }
        }

        // Using a DependencyProperty as the backing store for ScaleY.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty ScaleYProperty =
            DependencyProperty.Register("ScaleY", typeof(double), typeof(PanZoomSettings), new UIPropertyMetadata(1.0));

        public double TransformX
        {
            get { return (double)GetValue(TransformXProperty); }
            set { SetValue(TransformXProperty, value); }
        }

        // Using a DependencyProperty as the backing store for TransformX.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty TransformXProperty =
            DependencyProperty.Register("TransformX", typeof(double), typeof(PanZoomSettings), new UIPropertyMetadata(0.0));



        public double TransformY
        {
            get { return (double)GetValue(TransformYProperty); }
            set { SetValue(TransformYProperty, value); }
        }

        // Using a DependencyProperty as the backing store for TransformY.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty TransformYProperty =
            DependencyProperty.Register("TransformY", typeof(double), typeof(PanZoomSettings), new UIPropertyMetadata(0.0));

        public double UserScrollX
        {
            get { return (double)GetValue(UserScrollXProperty); }
            set { SetValue(UserScrollXProperty, value); }
        }

        // Using a DependencyProperty as the backing store for UserScrollX.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty UserScrollXProperty =
            DependencyProperty.Register("UserScrollX", typeof(double), typeof(PanZoomSettings), new UIPropertyMetadata(0.0));

        public double UserScrollY
        {
            get { return (double)GetValue(UserScrollYProperty); }
            set { SetValue(UserScrollYProperty, value); }
        }

        // Using a DependencyProperty as the backing store for UserScrollY.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty UserScrollYProperty =
            DependencyProperty.Register("UserScrollY", typeof(double), typeof(PanZoomSettings), new UIPropertyMetadata(0.0));


    }

    public class DrawingSettings
    {
        static DrawingSettings()
        {
            PanZoom = new PanZoomSettings();
            Point = new PointSettings();
        }

        public static PanZoomSettings PanZoom { get; set; }

        public static PointSettings Point { get; set; }

        public static RoutedUICommand ZoomBy = new RoutedUICommand("zoomby", "ZoomBy", typeof(DrawingSettings));

        public static RoutedUICommand MoveBy = new RoutedUICommand("zoomby", "ZoomBy", typeof(DrawingSettings));
    }
}
